package com.bestdreamer.synch.account2;

public class DrawThread extends Thread {
    // 模拟用户账户
    private final Account account;
    // 当前取钱线程所希望取的钱数
    private final double drawAmount;

    public DrawThread(String name, Account account, double drawAmount){
        super(name);
        this.account = account;
        this.drawAmount = drawAmount;
    }

    // 重复 100 此执行取钱操作
    public void run(){
        for( int i = 0; i < 100; i++){
            account.draw(drawAmount);
        }
    }
}
